package cn.iocoder.yudao.module.promotion.dal.mysql.prizedraw;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.promotion.controller.admin.prizedraw.vo.PrizeDrawLotteryPageReqVO;
import cn.iocoder.yudao.module.promotion.dal.dataobject.prizedraw.PrizeDrawLotteryDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 抽奖活动中奖 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface PrizeDrawLotteryMapper extends BaseMapperX<PrizeDrawLotteryDO> {

    default PageResult<PrizeDrawLotteryDO> selectPage(PrizeDrawLotteryPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<PrizeDrawLotteryDO>()
                .eqIfPresent(PrizeDrawLotteryDO::getUserId, reqVO.getUserId())
                .eqIfPresent(PrizeDrawLotteryDO::getPrizeDrawId, reqVO.getPrizeDrawId())
                .eqIfPresent(PrizeDrawLotteryDO::getIsLottery, reqVO.getIsLottery())
                .eqIfPresent(PrizeDrawLotteryDO::getPrizeDrawAwardsId, reqVO.getPrizeDrawAwardsId())
                .betweenIfPresent(PrizeDrawLotteryDO::getLotteryTime, reqVO.getLotteryTime())
                .betweenIfPresent(PrizeDrawLotteryDO::getExpiredTime, reqVO.getExpiredTime())
                .betweenIfPresent(PrizeDrawLotteryDO::getClaimTime, reqVO.getClaimTime())
                .eqIfPresent(PrizeDrawLotteryDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(PrizeDrawLotteryDO::getIssueTime, reqVO.getIssueTime())
                .eqIfPresent(PrizeDrawLotteryDO::getClaimRemark, reqVO.getClaimRemark())
                .eqIfPresent(PrizeDrawLotteryDO::getDeliverRemark, reqVO.getDeliverRemark())
                .eqIfPresent(PrizeDrawLotteryDO::getDeliverType, reqVO.getDeliverType())
                .eqIfPresent(PrizeDrawLotteryDO::getDeliverCompanyCode, reqVO.getDeliverCompanyCode())
                .eqIfPresent(PrizeDrawLotteryDO::getDeliverNo, reqVO.getDeliverNo())
                .eqIfPresent(PrizeDrawLotteryDO::getMemberAddressId, reqVO.getMemberAddressId())
                .eqIfPresent(PrizeDrawLotteryDO::getMemberAddress, reqVO.getMemberAddress())
                .betweenIfPresent(PrizeDrawLotteryDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(PrizeDrawLotteryDO::getPrizeDrawLotteryId));
    }

}